using System;
using Rhino.Security.Interfaces;
using WineCellar.Business.Entities;
using WineCellar.Business.ServiceInterfaces;
using WineCellar.Business.Services;
using WineCellar.Core.Interfaces;
using WineCellar.Core.Services;


namespace Parker.Business
{
    public class ParkerWineService :EntityService<ParkerWine>
    {
        private readonly IUserService _userService;
        private readonly IAuthorizationRepository _authRepos;

        public ParkerWineService(IUserService _userService, IAuthorizationRepository _authRepos)
        {
            this._userService = _userService;
            this._authRepos = _authRepos;
        }

        public override void Save(ParkerWine instance)
        {                           
            if (instance.Score < 95)
            {
                throw new InvalidOperationException("Hey, you cannot add wines with a score below 95 in this cellar...");
            }                                
            base.Save(instance);           
        }
    }
}